<template>
  <view>
    <view class="my-search-container" :style="{'background-color':bgcolor}">
      <view class="search-box" :style="{'border-radius':radius + 'px'}" @click="searchHandler">
        <uni-icons type="search" size="18"></uni-icons>
        <text>搜索</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    props:{
      // 1. 定制搜索框的背景色
      bgcolor:{
        type: String,
        default: '#c00'
      },
      // 2. 定制圆角半径
      radius:{
        type: Number,
        default: 18
      }
    },
    data() {
      return {
        
      };
    },
    methods:{
      searchHandler(){
        // 触发父组件的click事件
        this.$emit("click")
      }
    }
  }
</script>

<style lang="scss">
.my-search-container{
  // background-color: #c00;
  height: 50px;
  padding:0 10px;
  display: flex;
  align-items: center;
  .search-box{
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    // border-radius: 18px;
    width: 100%;
    height: 36px;
  }
}
</style>